package com.anhua.Util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@RestController
public class HellorController {
    @Autowired
    HelloServicrAutoConfiguration k;
    @Autowired
    private HelloService helloService;
    @Autowired
    private HelloService helloService2;
    @Autowired
    HelloProperties helloProperties;
    @GetMapping(value="/hello")
    @ResponseBody
    public String sayHello(){
        String s = helloService.sayHello();
        return helloService.sayHello();
    }
    @RequestMapping(value="/hello3")
    public String sayHello3(){
        String s = helloService2.sayHello();
        System.out.println(helloProperties.getName());
        return s;
    }
    @RequestMapping("/hello2")
    public String sayHello2() throws ParseException {

        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
        String format = simpleDateFormat.format(System.currentTimeMillis());
        Date parse = simpleDateFormat.parse(format);
        System.out.println(format);
        System.out.println(parse);
        String pattern = "yyyy-MM-dd";
        SimpleDateFormat df = new SimpleDateFormat(pattern);
        Date today = new Date();
        String tString = df.format(today);
        Date parse1 = df.parse(tString);
        return tString;

    }
}
